import 'whatwg-fetch'

export function findWeiboMap(options) {
  return fetch(`${options.source.app_server}/weibo`, {
    method: 'GET',
    credentials: 'include'
  }).then(function (response) {
    return response.json()
  })
}

export function paraiseWeibo({id, body}, options) {
  return fetch(`${options.source.app_server}/weibo/${id}`, {
    method: 'PATCH',
    credentials: 'include',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(body)
  }).then(function (response) {
    return response.json()
  })
}

export function deleteWeibo({id}, options) {
  return fetch(`${options.source.app_server}/weibo/${id}`, {
    method: 'DELETE',
    credentials: 'include'
  }).then(function (response) {
    return response.json()
  })
}
